<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link href="../../libs/mui.min.css" rel="stylesheet"/>
    <link href="../../libs/app.css" rel="stylesheet"/>
    <link href="../../css/main.css" rel="stylesheet"/>
    <link href="../../css/assess-d.css" rel="stylesheet"/>
</head>
<body>
<div class="head">
    <img class="mui-action-back" src="../../images/all-left.png" alt="">
    <p>汽车抵押贷</p>
</div>
<div class="content">
    <!--列表-->
    <div class="list">

        <!--行驶年限-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">行驶年限</div>
                <div class="lx-ri toast-one"><input class="bd-ri year" placeholder="单行输入" value="" type="number"/><span
                        class="bd-m">年</span></div>
            </div>
        </div>
        <!--行驶里程-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">行驶里程</div>
                <div class="lx-ri toast-two">
                    <input class="bd-ri mr2em km" placeholder="单行输入" value="" type="number"/>
                    <span class="bd-m">公里</span>
                </div>
            </div>
        </div>
        <!--车辆估值-->
        <div class="mui-table-view">
            <div class="mui-table-view-cell">
                <div class="lx-le">车辆估值</div>
                <div class="lx-ri toast-three">
                    <input class="bd-ri mr2em price" placeholder="单行输入" type="number"/>
                    <span class="bd-m">万元</span>
                </div>
            </div>
        </div>

        <!--还款期限期-->
        <!--<div id="xl-y" class=" mui-table-view">
            <div class="mui-table-view-cell">
                <a href="#already-pm">
                    <div class="lx-le">还款期限期</div>
                    <div id="payment-y" class="payment lx-ri infoone-qx">选择</div>
                </a>
            </div>
        </div>
        <div id="already-pm" class="payment-y mui-popover mui-popover-action mui-popover-bottom">
            <ul class="mui-table-view">
                <li class="mui-table-view-cell popover-bottom">
                    <a href="#">36期</span>
                    </a>
                </li>

            </ul>
            <ul class="mui-table-view">
                <li class="mui-table-view-cell popover-bottom-remove">
                    <a href="#already-pm">取消</a>
                </li>
            </ul>
        </div>-->

    </div>
    <!--按钮-->
    <div class="buttons">
        <!--<div class="add add-button">继续添加</div>-->
        <div class="add add-submit" id="evaluate">提交</div>
    </div>
</div>
<script src="../../libs/mui.min.js"></script>
<script src="../../js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/url.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/assess-public.js"></script>
<script type="text/javascript">
    $(function () {
//        var hold = plus.webview.currentWebview().hold;
//        hold && $.closePages([hold]);
    });

    //判断是否从申请页过来
    localStorage.isAssess === 'qcdy' ? mui.toast('请您先进行该项评估！') : '';
    localStorage.removeItem('isAssess')
    $('.toast-one').on('tap', function () {
        mui.toast("不超过7年")
    });
    $('.toast-two').on('tap', function () {
        mui.toast("不超过12万公里")
    });
    $('.toast-three').on('tap', function () {
        mui.toast("7万以上")
    });

    var params = new ToArr();
    $('#evaluate').on('tap', function () {
        //各参数数组
        var km = params.rechange('.km');
        var year = params.rechange('.year');
        var price = params.rechange('.price');
//				var stage = params.rechange('.infoone-qx', "期");、

        //将各参数数组转换成符合格式的请求参数
        var arrObj = {km: km, year: year, price: price};//, stage: stage
        var resParam = params.getParams(arrObj);

        var nian = /^[1-9]\d*$/;
        var yuan = /^[0-9]+(.[0-9]{1,4})?$/;

        for (var i = 0; i < resParam.length; i++) {
            if ((!nian.test(year[i])) || year[i] == undefined || year[i] == null || year[i] > 7) {
                mui.toast('请检查您车辆使用年限...');
                return;
            } else if ((!nian.test(km[i])) || km[i] == undefined || km[i] == null || km[i] > 12000) {
                mui.toast('请检查您行驶里程...');
                return;
            } else if ((!yuan.test(price[i])) || price[i] == undefined || price[i] == null) {//|| price[i] < 7
                mui.toast('请检查您评估价...');
                return;
            } /*else if(stage[i] == undefined || stage[i] == null || stage[i] == '选择') {
             mui.toast('请把信息填充完整...');
             return;
             }*/ else {
                if (i === resParam.length - 1) {
                    params.getAjax("qcdy", resParam);
                }
            }
        }
    });
</script>
</body>

</html>